﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BeanboxSoftware.BeanMap;

namespace BeanMapTest
{
  [TestClass]
  public class IDictionaryTest
  {
    [TestMethod]
    public void KVCastTest()
    {
      var map = new Map<int, char>();
      var dict = (IDictionary<int, char>)map;

      map[1] = 'c';
      Assert.AreEqual('c', dict[1]);
    }

    [TestMethod]
    public void KKVCastTest()
    {
      var map = new Map<int, string, char>();
      var dict = (IDictionary<int, IDictionary<string, char>>)map;

      map[1, "one"] = 'c';
      Assert.AreEqual('c', dict[1]["one"]);
    }

    [TestMethod]
    public void KKKVCastTest()
    {
      var map = new Map<int, string, decimal, char>();
      var dict = (IDictionary<int, IDictionary<string, IDictionary<decimal, char>>>)map;

      map[1, "one", 8m] = 'c';
      Assert.AreEqual('c', dict[1]["one"][8m]);
    }
  }
}
